const { ethers } = require("hardhat");
const dotenv = require("dotenv");
// require("dotenv").config();
dotenv.config("./env");
async function deploy() {
  const [deployer] = await ethers.getSigners();
  console.log("Deploying contracts with the account:", deployer.address);
  console.log(await ethers.provider.getBalance(deployer.address));
  //   console.log("Account balance:", (await deployer.getBalance()).toString());

  const cUSDTContract = await ethers.getContractFactory("cUSDT");
  const myNFTContract = await ethers.getContractFactory("MyNFT");
  const marketContract = await ethers.getContractFactory("Market");
  const cUSDT = await cUSDTContract.deploy();
  const myNft = await myNFTContract.deploy();
  //   await cUSDT.deployed();
  //   await myNft.deployed();
  const market = await marketContract.deploy(cUSDT.target, myNft.target);
  console.log("cUSDT deployed to:", cUSDT.target);
  console.log("MyNFT deployed to:", myNft.target);
  console.log("Market deployed to:", market.target);
  //   await instance.deployed();
}
deploy()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });
